<!-- 
* 用户页面 
* 2019年5月16日17:06:10
* penglei
* -->
<template>
	<view class="content">
		<scroll-view  class="_bg_middle" 
		@scrolltoupper='uppper'
		@scrolltolower='lower'
		@scroll='scroll'
		@touchstart="touchstart"
		:upper-threshold="upperthreshold"
		:lower-threshold="lowerthreshold"
		scroll-y="true">
			<m-content :listData='dataList' @click='getHistory'></m-content>
		</scroll-view>
		<cmd-bottom-nav @click="tapNav"  border-color="#BC1BBE" background-color="#BC1BBE" font-color="#fff" active-font-color="#fff"></cmd-bottom-nav>
	</view>
</template>

<script>
	import mContent from '@/components/m-content/m-content.vue'
	import cmdBottomNav from "@/components/cmd-bottom-nav/cmd-bottom-nav.vue"
	import comm from '../../common/helpers.js'
	import util from '../../static/js/util.js'
    // import {
    //     mapState,
    //     mapMutations
    // } from 'vuex'
    export default {
		components:{cmdBottomNav,mContent},
		data(){
			return{
				oid:'',
				dataList:[],
				upperthreshold:150,
				lowerthreshold:150
			}
		},
		onLoad(e) {
			let that = this
			uni.request({
				url: comm.websiteUrl +'?s=v1/getgroupbymid/',
				method: 'POST',
				data: {
					'mid':e.oid
				},
				success: res => {
					that.dataList=res.data.data
					// console.log(that.dataList)
					// for (let data in res.data.data) {
					// 	let db = res.data.data[data]
					// 	for (let index in db) {
					// 		for (let item in db[index]) {
					// 			that.dataList.push(db[index][item])
					// 		}
					// 	}
					// }
				},
				fail: () => {},
				complete: () => {}
			});
		},
        computed: {
        },
        methods: {
			tapNav(e){
				let that = this
				let path = e.item.pagePath
				uni.switchTab({
					url:path,
					success: (res) => {
					},
					complete: (com) => {
					}
				})
			},
			/**
			 * @param {Object} e：查看历史数据
			 */
			getHistory(e){
				uni.setStorageSync('ue',e)
				util.navTo('/pages/card/main_card_res_history')
			},
			uppper(){
				// console.log('刷新...')
			},
			lower(){
				// console.log('加载更多...')
			},
			scroll(){
				
			},
			touchstart(){
				
			}
		}
    }
</script>

<style lang="scss">
	.content{
		padding: 0upx;
		background-color: white;
		background-image: url("https://zhanbu.nomeis.cn/upload/page_resource/bg3.png");
		background-size: 100% 95%;
		background-repeat:repeat-y;
		
		._label_top{
			width:100%;
			height:100upx;
			position:absolute;
			text-align:center;
			margin-top: 45upx;
			
			image{
				width:100upx;
				height:100upx;
			}
			
			._lab_top{
				width:100%;
				display:flex;
				justify-content:center;
				color: white;
				font-size: 11pt;
			}
		}
		
		._bg_middle{
			width:100%;
			height: 100%;
			margin:auto;
			padding:15upx;
		}
	}
</style>
